using System;
using System.Security.Cryptography;
using System.Text;
using Catastrophe.Common.FileM;

namespace Catastrophe.Common.EndeCrypt
{
	public class Md5Cal : IEncrypt
	{
		public string BaseEncode(EncodeTypeEnum codeType, string value)
		{
			MD5 mD = new MD5CryptoServiceProvider();
			byte[] bytes = Encoding.GetEncoding(GetEncodeTypeActual.GetValue(codeType)).GetBytes(value);
			byte[] inArray = mD.ComputeHash(bytes);
			return Convert.ToBase64String(inArray);
		}

		public string BaseDecode(EncodeTypeEnum codeType, string value)
		{
			throw new NotImplementedException();
		}

		public string Md5EncodeHex(EncodeTypeEnum codeType, string value)
		{
			StringBuilder stringBuilder = new StringBuilder();
			MD5 mD = new MD5CryptoServiceProvider();
			byte[] bytes = Encoding.GetEncoding(GetEncodeTypeActual.GetValue(codeType)).GetBytes(value);
			byte[] array = mD.ComputeHash(bytes);
			byte[] array2 = array;
			foreach (byte b in array2)
			{
				stringBuilder.Append(b.ToString("X2").ToUpper());
			}
			return stringBuilder.ToString();
		}
	}
}
